package com.qding.park.manager.app.queue.handle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.qding.park.common.core.exceptions.BaseException;
import com.qding.park.common.core.redis.SerializeUtils;
import com.qding.park.manager.facade.queue.service.DelayCheckFacade;
import com.qding.park.manager.pojo.TbReserve;
import com.qding.park.manager.pojo.queue.QueueMsg;

/**
  * @ClassName: ReserveDelayTimeoutHandle
  * @Description: 预定延期超时
  * @author Comsys-Administrator
  * @date 2016年10月20日 上午10:10:31
  *
  */
@Component("reserveDelayTimeoutHandle")
public class ReserveDelayTimeoutHandle extends AbstractAllHandle{
	/**
	 * @Field @inviteFacade : TODO(预定单核心业务)
	 */
	@Autowired
	private DelayCheckFacade  delayCheckFacade;
	
	@Override
	void actualHandle(QueueMsg msg) throws BaseException {
		JSONObject data = (JSONObject) msg.getData();
		TbReserve tbReserve=SerializeUtils.unSerialize(data.toJSONString(), TbReserve.class);
		delayCheckFacade.reserveDelayTimeOut(tbReserve);
	}


	@Override
	boolean failDiscardRollBacK(QueueMsg msg) {
		_log.info("预定延期超时任务回滚:"+msg);
		return true;
	}
	
}
